//BFS
#include <iostream>
#include <unordered_set>
#include <queue>
#include <cstring>

using namespace std;

int main(){
	
	int m,n;
	pair<int ,int> p;
	cin >> n >> m >> p.second >> p.first;
	p.first -= 1;
	p.second -= 1;
	
	int visited[n][m];
	memset(visited,-1,sizeof(visited));
	queue<pair<int,int>> que;
	que.push(p);
	visited[p.second][p.first] = 0;
	pair<int,int> move[8] = {{1,-2},{1,2},{2,1},{2,-1},{-1,2},{-1,-2},{-2,1},{-2,-1}};
	int step = 1;
	while(!que.empty()){
		int size = que.size();
		for(int i = 0; i < size ; i++){
			int x = que.front().first;
			int y = que.front().second;
			que.pop();
			for(auto val : move){
				int dy = y + val.first;
				int dx = x + val.second;
				if(dx >= 0 && dx < m && dy >= 0 && dy  < n && visited[dy][dx] == -1){
					visited[dy][dx] = step;
					que.push({dx,dy});
				}
			}
		}
		step++;
	}
	
	for(int i = 0; i < n; ++i){
		for(int j = 0; j < m; ++j){
			cout << visited[i][j] << ' ';
		}
		cout << endl;
	}
	
	return 0;
}
